/**
 * 
 */
package com.sci.web.daoimpl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.sci.web.bean.Enterprise_Research;

/**
 * @author  BaiFuyou
 * @date: Nov 4, 2011 3:57:57 PM
 */
public class DataReportM_ReaearchDao extends SqlMapClientDaoSupport implements com.sci.web.dao.DataReportM_ReaearchDao {

	/* (non-Javadoc)
	 * @see com.sci.web.dao.DataReportM_ReaearchDao#getAllEnterprise_ResearchByUserId(int)
	 */
	@SuppressWarnings("unchecked")
	@Override
	public List<Enterprise_Research> getAllEnterprise_ResearchByUserId(int userid) {
		// TODO Auto-generated method stub
		return super.getSqlMapClientTemplate().queryForList("datereportseason.getallenterpriseresearchdata",userid);
	}

	@Override
	public boolean insertNewEnterpriseResearchData(Enterprise_Research er) {
		// TODO Auto-generated method stub
		return (Integer)super.getSqlMapClientTemplate().insert("datereportseason.insertnewenterpriseresearchdata",er)>0?true:false;
	}

	@Override
	public int getEnterpriseBaseId(int userid) {
		// TODO Auto-generated method stub
		return (Integer)super.getSqlMapClientTemplate().queryForObject("datereportseason.getenid",userid);
	}

	@Override
	public boolean updateEnterpriseResearchById(Enterprise_Research er) {
		// TODO Auto-generated method stub
		return (Integer)super.getSqlMapClientTemplate().update("datereportseason.updateerbyid",er)>0?true:false;
	}

	@Override
	public boolean isEnterpriseResearchExist(int uid, String year, int type) {
		// TODO Auto-generated method stub
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("year", year);
		map.put("type", type);
		return (Integer)super.getSqlMapClientTemplate().queryForObject("datereportseason.isallenterpriseresearchdataexist",map)>0?true:false;
	}

}
